package com.seedwill.common.persistence;

import java.io.Serializable;
import java.util.List;

import com.seedwill.common.model.CompositeObject;
import com.seedwill.common.model.CompositeObjectSchema;
import com.seedwill.common.model.Pair;
import com.seedwill.common.view.IPagnationView;
import com.seedwill.common.view.ITreeView;
import com.seedwill.xul.core.XSchemaFilter;

/**
 * 数据查询支持接口
 * 
 * @author kdyi
 *
 */
public interface IDataQuerySupport {
	/**
	 * 查找
	 * @param type
	 * @param id
	 * @return
	 * @throws DataAccssException
	 */
	public Object findById(String type, java.io.Serializable id) throws DataAccssException;
	/**
	 * 查找
	 * @param type
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public Object getSclarObjectByFilter(String type, Filter... filter) throws DataAccssException;
	public Object getSclarObjectByFilter(String type, XSchemaFilter... filter) throws DataAccssException;
	/**
	 * 查找
	 * @param type
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public Object[] getObjectArrayByFilter(String type, Filter... filter) throws DataAccssException;
	public Object[] getObjectArrayByFilter(String type, XSchemaFilter... filter) throws DataAccssException;
	/**
	 * 查找
	 * @param type
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public int countObjectByFilter(String type, Filter... filter) throws DataAccssException;
	public int countObjectByFilter(String type, XSchemaFilter... filter) throws DataAccssException;
	/**
	 * 查找
	 * @param type
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public List getObjectListByFilter(String type, Filter... filter) throws DataAccssException;
	public List getObjectListByFilter(String type, XSchemaFilter... filter) throws DataAccssException;
	/**
	 * @param type
	 * @param attribute
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public List getAttributeListByFilter(String type, String attribute, Filter... filter) throws DataAccssException;
	public List getAttributeListByFilter(String type, String attribute, XSchemaFilter... filter) throws DataAccssException;
	/**
	 * @param type
	 * @param attribute
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public List getAttributeArrayListByFilter(String type, String attribute[], Filter... filter) throws DataAccssException;
	public List getAttributeArrayListByFilter(String type, String attribute[], XSchemaFilter... filter) throws DataAccssException;
	/**
	 * @param type
	 * @param attVal
	 * @param attText
	 * @param attTag
	 * @param attData
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public List<Pair> getPairListByFilter(String type, String attVal, String attText, String attTag, String attData, Filter... filter) throws DataAccssException;
	public List<Pair> getPairListByFilter(String type, String attVal, String attText, String attTag, String attData, XSchemaFilter... filter) throws DataAccssException;
	

	/**
	 * 分页查询
	 * @param type
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public IPagnationView getPageByFilter(FilterContainer filterContainer) throws DataAccssException;
 
	public IPagnationView getPageByFilter(XSchemaFilterContainer filterContainer) throws DataAccssException;
	/**
	 * @param filter
	 * @return
	 * @throws DataAccssException
	 */
	public ITreeView getTreeByFilter(FilterContainer filter) throws DataAccssException;
	/**
	 * 查组合实体
	 * @param schemaType
	 * @param id
	 * @return
	 * @throws DataAccssException
	 */
	public CompositeObject findEntity(String schemaType, Serializable id) throws DataAccssException;
	public CompositeObject findEntity(CompositeObjectSchema schema, java.io.Serializable id) throws DataAccssException;

	
	public List<Pair> querySimplePairItemList(String schemaCode, String code, String name) throws DataAccssException;
	public List queryList(String type);
}
